package threadstop;

public class TerminateThread extends Thread {
	
	public static boolean all_exit = false;
	
	private boolean flag = false;
	
	public void run() {
		System.out.println(this.getName() + " 스레드 시작");
		while (!flag && !all_exit) {
			try {
				Thread.sleep(100);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		System.out.println(this.getName() + " 스레드 종료");
	}
	
	public void setFlag(boolean flag) {
		this.flag = flag;
	}
	
}
